<template>
    <div id="house-item">
        <div class="item">
            <div class="img">
                <img :src="data.image.url" alt="">
            </div>
            <div class="info">
                <span class="title">{{data.summaryText}}</span>
                <span class="text">{{data.houseName}}</span>
                <span class="score">
                    <div><van-rate readonly size="10px" color="#ffd21e" allow-half v-model="Score" /></div>
                    <div>￥{{data.finalPrice}}</div>
                </span>
            </div>
        </div>
    </div>
</template>
    
<script setup>
import { computed } from "@vue/runtime-core"

const props = defineProps({
    data: {
        type: Object,
        default: () => ({})
    }
})
const Score = computed(()=>{
    return Number(props.data.commentScore)
})
</script>
     
<style lang="less" scoped>
#house-item {
    margin-bottom: 10px;
    .item {
        position: relative;
        .img {
            width: 162px;

            img {
                width: 100%;
                height: 250px;
                border-radius: 5px;
            }
        }

        .info {
            position: absolute;
            width: 160px;
            padding: 10px;
            box-sizing: border-box;
            bottom: 0;
            left: 0;
            color: white;
            font-size: 14px;
            line-height: 1.2;
            span{
                margin: 3px 0;
            }
            .title{
                font-size: 12px;
            }
            .text {
                word-break: break-all;
                text-overflow: ellipsis;
                display: -webkit-box;
                -webkit-box-orient: vertical;
                -webkit-line-clamp: 2;
                /* 这里是超出几行省略 */
                overflow: hidden;
            }

            .score {
                display: flex;
                justify-content: space-between;
            }
        }
    }
}
</style>